<template>
	<view class="all-main">
		<view class="main">
			<view class="con">
				<view class="titles">
					<view class="lefts">
						{{detail.mome}}
					</view>
					<view v-if="detail.earn_type == 1" class="rights greens">
						+{{detail.changes}}
					</view>
					<view v-else class="rights reds">
						-{{detail.changes}}
					</view>
				</view>
				<view class="items">
					<view v-if="detail.balance_type_id == 14 || detail.balance_type_id == 15 || detail.balance_type_id == 6" class="lefts">
						订单号
					</view>
					<view v-else class="lefts">
						SN
					</view>
					<view class="rights">
						{{detail.sn}}
					</view>
				</view>
				<view v-if="detail.balance_type_id == 1 && detail.trades" class="items">
					<view class="lefts">
						商户名称
					</view>
					<view class="rights">
						{{detail.trades.merchant_names}}
					</view>
				</view>
				<view v-if="detail.balance_type_id == 1 && detail.trades" class="items">
					<view class="lefts">
						交易金额
					</view>
					<view class="rights">
						{{detail.trades.money}}
					</view>
				</view>
				<view v-if="detail.balance_type_id == 1 && detail.trades" class="items">
					<view class="lefts">
						交易类型
					</view>
					<view class="rights">
						{{detail.trades.order_type}}
					</view>
				</view>
				<view v-if="detail.balance_type_id == 1 && detail.trades" class="items">
					<view class="lefts">
						费率
					</view>
					<view class="rights">
						{{detail.trades.rates}}
					</view>
				</view>
				<view v-if="detail.balance_type_id == 2" class="items">
					<view class="lefts">
						次数
					</view>
					<view class="rights">
						第{{detail.trades.number}}次
					</view>
				</view>
				<view v-if="detail.balance_type_id == 3" class="items">
					<view class="lefts">
						达标档次
					</view>
					<view class="rights">
						【{{detail.trades.start_day}} ~ {{detail.trades.end_day}}】【{{detail.trades.money}}】
					</view>
				</view>
				<view class="items">
					<view class="lefts">
						时间
					</view>
					<view class="rights">
						{{detail.trading_time}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				type: '',
				detail: {}
			}
		},
		onLoad(e) {
			this.id = e.id
			this.type = e.type
			this.loadData()
		},
		methods: {
			// 加载数据
			async loadData() {
				uni.showLoading({
					title: '加载中'
				});
				const {
					data: res
				} = await this.$myHttp({
					url: 'v1/getHzyMoneyDetail',
					data: {
						id: this.id,
						type: this.type
					}
				});
				uni.hideLoading()
				if (res.code == 200) {
					this.detail = res.data
				}
			},
		}
	}
</script>

<style lang="scss">
	.all-main {
		.main {
			padding: 30rpx;
			
			.con {
				background-color: #ffffff;
				border-radius: 16rpx;
				
				.titles {
					display: flex;
					justify-content: space-between;
					padding: 30rpx;
					border-bottom: 1px solid #c8c9cc;
					
					.lefts {
						font-weight: bold;
					}
					
					.greens {
						color: #19be6b;
					}
					
					.reds {
						color: #fa3534;
					}
				}
				
				.items {
					padding: 30rpx;
					display: flex;
					justify-content: space-between;
					border-bottom: 1px solid #F2F6FC;
					
					.lefts {
						width: 25%;
					}
					
					.rights {
						color: #909399;
					}
				}
			}
		}
	}
</style>
